unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, RzStatus, IdBaseComponent, IdComponent,
  IdTCPConnection, IdTCPClient, IdHTTP,Thrad_CallHome, rtcInfo, rtcConn,
  rtcDataSrv, rtcHttpSrv;

type
  TForm1 = class(TForm)
    Btnx_1: TButton;
    Btnx_2: TButton;
    RzVersionInfo1: TRzVersionInfo;
    IdHTTP1: TIdHTTP;
    HtpSrv_1: TRtcHttpServer;
    procedure FormShow(Sender: TObject);
    procedure Btnx_2Click(Sender: TObject);
    procedure Btnx_1Click(Sender: TObject);
  private
  public
    procedure CallThradCallHome;
  end;

var
  Form1: TForm1;

implementation

uses
  Class_KzUtils;

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
begin
  Caption:=Self.RzVersionInfo1.FileVersion;
end;

procedure TForm1.Btnx_2Click(Sender: TObject);
var
  MVAL:TMemoryStream;
begin
  try
    MVAL:=TMemoryStream.Create;
    //Self.IdHTTP1.Get('http://192.168.0.51:8188/downloadit?path=update/example10001.exe',MVAL);
    //MVAL.SaveToFile(TKzUtils.ExePath+'example10001.tmp');
    WinExec(PChar('callhome -helloworld'),0);   
    Application.Terminate;
  finally
    FreeAndNil(MVAL);
  end;
end;

procedure TForm1.CallThradCallHome;
var
  ThradA:TThradCallHome;
begin
  ThradA:=TThradCallHome.Create(True);
  ThradA.Resume;  
end;

procedure TForm1.Btnx_1Click(Sender: TObject);
var 
  FullProgPath: PChar; 
begin 
  FullProgPath := PChar(Application.ExeName); 
  WinExec(FullProgPath, SW_SHOW); 
  Application.Terminate; 
end;

end.
